/**
 * 商户维护
 * @constructor
 */
function Setting() {
}

Setting.init = function () {
    WriteData();
}
//操作相关方法****************************
function actionRecord(data,type) {
    var postdata={};
    if(type=="notityday")
    {
        postdata = {
            action: type,
            notityDay1: $("#text_notityday1").val(),
            notityDay2: $("#text_notityday2").val(),
            notityDay3: $("#text_notityday3").val(),
        };
    }
    else  if(type=="offtime")
    {
        postdata = {
            action: type,
            offTime: $("#text_offTime").val(),
        };
    }
    $.ajax({
        url:"/setting/action",
        type:"post",
        data:JSON.stringify(postdata),
        contentType:"application/json",
        dataType:"json",
        success:function(data){
            if (data.code === "200") {
                swal("操作成功!", "请继续操作", "success");
            } else {
                swal("操作失败!", "请重试", "error");
            }
        }
    })
}

//给控件赋值****************************
function WriteData() {
    $.ajax({
        url:"/setting/getById/1",
        type:"get",
        contentType:"application/json",
        dataType:"json",
        success:function(data){
            if (data.code == "200") {
                $("#text_notityday1").val(data.data.notityDay1);
                $("#text_notityday2").val(data.data.notityDay2);
                $("#text_notityday3").val(data.data.notityDay3);
            }
        }
    })
}
//*****************************************************************************************
